import {
  IsString,
  IsEmail,
  IsNumber,
  IsOptional,
  IsArray,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { CreateEventDto } from 'src/modules/event/dto/create-event.dto';
import { Type } from 'class-transformer';
import { PlayerSignup } from '../entities/player-signup.entity';
import { CreatePlayerSignupDto } from './create-player-signup.dto';
import { IdObject } from 'src/common/utils/types';

class keyObject {
  @ApiPropertyOptional({ description: '唯一标识' })
  @IsOptional()
  @IsString()
  key: string;
}

export class CreateTeamSignupDto {
  @ApiProperty({ description: ' 报名人员的唯一标识' })
  @IsString()
  @IsOptional()
  key?: string;

  @ApiProperty({ description: '选手姓名' })
  @IsString()
  name: string;

  @ApiProperty({
    description: '报名的赛事ID',
    type: IdObject,
    isArray: true,
  })
  @IsArray()
  @Type(() => IdObject)
  events?: Array<IdObject>;

  @ApiProperty({
    description: '团赛子选手',
    type: keyObject,
    isArray: true,
  })
  @IsArray()
  @Type(() => keyObject)
  subPlayerSignups: Array<keyObject>;

  // @ApiPropertyOptional({ description: '团赛子比赛ID' })
  // @IsOptional()
  // @IsNumber()
  // stageEventId?: number;

  @ApiPropertyOptional({ description: '选手所属组织/单位' })
  @IsOptional()
  @IsString()
  organization?: string;

  createBy?: number;

  createTime?: Date;

  updateBy?: number;

  updateTime?: Date;
}
